<template>
	<view v-if="value">
		<view class="AgreementModal">
			<view class="AgreementModal-box" @click.stop>
				<view class="AgreementModal-box-title">
					<view>您需要同意协议</view>
					<view>才能体验完整功能哦</view>
				</view>
				<view class="AgreementModal-box-tips" @click.stop="close">
					<image class="AgreementModal-box-tips-img" src="/static/images/Agreement/icon_xieyi_back.png" />
					<text class="AgreementModal-box-tips-txt">重新查看条款</text>
				</view>
				<view class="AgreementModal-box-btn">
					<view class="AgreementModal-box-btn-left" @click.stop="quitApp">
						<text>退出应用</text>
					</view>
					<view class="AgreementModal-box-btn-right" @click.stop="agree">
						<text>同意并继续</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { isIos } from '@/utils';

export default {
	name: 'AgreementModal',
	props: {
		value: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {};
	},
	methods: {
		quitApp() {
			// #ifdef APP-PLUS
			if (isIos()) {
				plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
			} else {
				plus.runtime.quit();
			}
			// #endif
		},
		close() {
			this.$emit('input', false);
		},
		agree() {
			this.$emit('agree');
		}
	}
};
</script>

<style lang="scss" scoped>
.AgreementModal {
	width: 100vw;
	height: 100vh;
	position: fixed;
	top: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 10;
	display: flex;
	justify-content: center;
	align-items: center;
	&-box {
		background: #ffffff;
		border-radius: 24rpx;
		padding: 64rpx 24rpx 40rpx 24rpx;
		&-title {
			text-align: center;
			font-size: 32rpx;
			font-weight: 500;
			color: #333333;
		}
		&-tips {
			margin: 32rpx 0 80rpx 0;
			display: flex;
			justify-content: center;
			align-items: center;
			&-img {
				width: 32rpx;
				height: 32rpx;
				margin-right: 12rpx;
			}
			&-txt {
				font-size: 28rpx;
				font-weight: 400;
				color: #999999;
			}
		}
		&-btn {
			display: flex;
			justify-content: space-between;
			align-items: center;
			view {
				width: 260rpx;
				line-height: 80rpx;
				border-radius: 24rpx;
				text-align: center;
				font-size: 28rpx;
				font-weight: 500;
			}
			&-left {
				background: #f5f5f5;
				color: #999999;
				margin-right: 22rpx;
			}
			&-right {
				background: #ff6b11;
				color: #ffffff;
			}
		}
	}
}
</style>
